<template>
  <div>
    <van-row>
      <van-col span="24"><Myheader /></van-col>
    </van-row>
    <van-row>
      <van-col span="4"><Myleft @get-id="getinfo" /></van-col>
      <van-col span="20">
        <van-row>
          <van-col span="24">
            <Group_manage :data="grouplist" v-if="cat_id==0" @send-id="getcompany" :id="id" />
            <User_manage v-if="cat_id==1"  />
          </van-col>
        </van-row>
      </van-col>
    </van-row>


  </div>
</template>

<script>
// import {reactive,ref} from 'vue';
import myaxios from "../../https/myaxios";
import Myleft from "@/components/lab/myleft";
import Myheader from "@/components/lab/myheader";
import Group_manage from "@/components/lab/group_manage";
import User_manage from "@/components/lab/user_manage";
export default {
  components:{
    Myleft,
    Myheader,
    Group_manage,
    User_manage
  },
  name: "test",
  data(){
    return{
      // flag:false,
      grouplist:[],
      id:0,
      cat_id:""
    }
  },
  methods:{
    getcompany(id){
      this.id=id
    },
    getinfo(val){
      // alert(val)
      this.cat_id=val
      this.getdata()
      // alert(this.cat_id)
    },

    getdata(){
      myaxios('group','get').then(res=>{
        this.grouplist = res.list
        // for(var i=0;i<this.grouplist.length;i++){
        //   this.grouplist[i]["label"]=this.grouplist[i]["name"]
        // }
        console.log(this.grouplist)
      })
    }
  },
  mounted() {
  }
}
</script>

<style scoped>

</style>